package cn.deschen.common.config.map;

import ma.glasnost.orika.MapperFacade;
import ma.glasnost.orika.MapperFactory;
import ma.glasnost.orika.converter.ConverterFactory;
import ma.glasnost.orika.impl.DefaultMapperFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @Author hanbin_chen
 * @Description 类转换工具配置
 * @DateTime 2021/6/1
 * @Version V1.0.0
 */
@Configuration
public class OrikaMapperFactoryConfig {

    @Bean
    public MapperFactory createMapperFactory() {
        MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
        ConverterFactory converterFactory = mapperFactory.getConverterFactory();
        return mapperFactory;
    }

    @Bean
    public MapperFacade createMapperFacade(MapperFactory mapperFactory) {
        return mapperFactory.getMapperFacade();
    }

}